public class h_7_increase implements Runnable {
    h_7_demo h7;
    public h_7_increase(h_7_demo h7){
        this.h7=h7;
    }
    @Override
    public void run() {
        while(0<h7.j && h7.j<20){
            synchronized (h7){
                h7.setJ(h7.getJ()+1);
                System.out.println(h7.getJ()+":"+Thread.currentThread().getName());
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
